﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using SubSonic;

namespace Medianamik.Core
{
    public class NodeTypeNameValidator
    {
        private const string VALIDATION_REGEX = "^[A-Z][a-zA-Z]*$";
        private readonly ICodeLanguage _codeLanguage;
        public NodeTypeNameValidator(ICodeLanguage pCodeLanguage)
        {
            _codeLanguage = pCodeLanguage;
        }
        public bool Validate(string typeName)
        {
            return Regex.IsMatch(typeName, VALIDATION_REGEX)
                && !_codeLanguage.IsKeyword(typeName) ;
        }
    }
}
